#ifndef _CCALENDAREVENT_H_
#define _CCALENDAREVENT_H_

#include "auto.h"

#include <buola/datetime/cdatetime.h>

#include <libical/ical.h>

namespace buola { namespace bcal {

class CCalendarEvent
{
public:
    struct AStartOrder
    {
        bool operator()(CCalendarEvent *p1,CCalendarEvent *p2)
        {
            return p1->mStart<p2->mStart;
        }
    };

    CCalendarEvent(const CCalendarTime &pStart,const CCalendarTime &pEnd);
    CCalendarEvent(CCalendar *pCalendar,icalcomponent *pC);
    ~CCalendarEvent();

    bool IsBetween(const CCalendarTime &pFrom,const CCalendarTime &pTo);
    bool IsAllDay()         {   return mIsAllDay;   }

    void SetCalendar(CCalendar *pCal)   {   mCalendar=pCal; }

    const CCalendarTime &GetStart()     {   return mStart;      }
    const CCalendarTime &GetEnd()       {   return mEnd;        }
    std::wstring GetSummary();
    std::wstring GetDescription();

    void SetStart(const CCalendarTime &pTime);
    void SetEnd(const CCalendarTime &pTime);
    void SetSummary(const std::wstring &pSummary);
    void SetDescription(const std::wstring &pDescription);

    void Dump(io::CTextWriter &pWriter);

private:
    CCalendar *mCalendar;

    icalcomponent *mComponent;

    CCalendarTime mStart;
    CCalendarTime mEnd;

    bool mIsAllDay;
};

/*namespace buola*/ } /*namespace bcal*/ }

#endif
